package com.gavchap2d.starfield;

import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.widget.LinearLayout;

import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
import com.live.wallpaper.R;

public class Settings extends PreferenceActivity
    implements SharedPreferences.OnSharedPreferenceChangeListener {

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        
        setContentView(R.layout.all_settings);
    	// this is the best way I've found to disable the stupid transparent
    	// background
    	getListView().setBackgroundColor(Color.WHITE);
    	getListView().setCacheColorHint(Color.WHITE);
    	// Ads
    	final LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout);
    	final AdView adView = new AdView(this, AdSize.BANNER, "a14e6100232e8f0");
    	layout.addView(adView);
    	adView.loadAd(new AdRequest());
    	
    	
        getPreferenceManager().setSharedPreferencesName(
                StarfieldWallpaper.SHARED_PREFS_NAME);
        addPreferencesFromResource(R.xml.settings);
        getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(
                this);
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(
                this);
        super.onDestroy();
    }

    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
            String key) {
    }
}